<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Subject-Observer: PKW Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Subject-Observer
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.2 -->
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('class_p_k_w.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_p_k_w-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">PKW Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Represents a <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> which is a specialisation of an <a class="el" href="class_automobile.html" title="Represents an Automobile.">Automobile</a>.  
 <a href="class_p_k_w.html#details">More...</a></p>

<p><code>#include &lt;PKW.h&gt;</code></p>
<div class="dynheader">
Inheritance diagram for PKW:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_p_k_w.png" usemap="#PKW_map" alt=""/>
  <map id="PKW_map" name="PKW_map">
<area href="class_automobile.html" title="Represents an Automobile." alt="Automobile" shape="rect" coords="0,56,74,80"/>
<area href="class_object.html" title="Common Baseclass for all other classes." alt="Object" shape="rect" coords="0,0,74,24"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ac57dd13707ca4927aafd391d01b5b445"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_p_k_w.html#ac57dd13707ca4927aafd391d01b5b445">PKW</a> (size_t wheel_diameter, <a class="el" href="class_wheel_spin_sensor.html">WheelSpinSensor</a> *sens)</td></tr>
<tr class="memdesc:ac57dd13707ca4927aafd391d01b5b445"><td class="mdescLeft">&#160;</td><td class="mdescRight">The CTor of the <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a>.  <a href="#ac57dd13707ca4927aafd391d01b5b445"></a><br/></td></tr>
<tr class="separator:ac57dd13707ca4927aafd391d01b5b445"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a49bb675b5f0878b6e1a802c518c2f476"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_p_k_w.html#a49bb675b5f0878b6e1a802c518c2f476">~PKW</a> ()</td></tr>
<tr class="memdesc:a49bb675b5f0878b6e1a802c518c2f476"><td class="mdescLeft">&#160;</td><td class="mdescRight">DTor of the <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a>.  <a href="#a49bb675b5f0878b6e1a802c518c2f476"></a><br/></td></tr>
<tr class="separator:a49bb675b5f0878b6e1a802c518c2f476"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a81df69d9bf3f95fc114a7f73e3657be7"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_p_k_w.html#a81df69d9bf3f95fc114a7f73e3657be7">GetCurrentSpeed</a> () const </td></tr>
<tr class="memdesc:a81df69d9bf3f95fc114a7f73e3657be7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the current speed of the car.  <a href="#a81df69d9bf3f95fc114a7f73e3657be7"></a><br/></td></tr>
<tr class="separator:a81df69d9bf3f95fc114a7f73e3657be7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2c57cf65470a857c1c37e662433c16fd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_p_k_w.html#a2c57cf65470a857c1c37e662433c16fd">Process</a> ()</td></tr>
<tr class="memdesc:a2c57cf65470a857c1c37e662433c16fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Update the current speed.  <a href="#a2c57cf65470a857c1c37e662433c16fd"></a><br/></td></tr>
<tr class="separator:a2c57cf65470a857c1c37e662433c16fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_class_automobile"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_class_automobile')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="class_automobile.html">Automobile</a></td></tr>
<tr class="memitem:a43b310835f4c5f0ab84a3bc1110e8bda inherit pub_methods_class_automobile"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_automobile.html#a43b310835f4c5f0ab84a3bc1110e8bda">Attach</a> (<a class="el" href="class_i_display.html">IDisplay</a> *obs)</td></tr>
<tr class="memdesc:a43b310835f4c5f0ab84a3bc1110e8bda inherit pub_methods_class_automobile"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds a Display (Observer) to the list of observers.  <a href="#a43b310835f4c5f0ab84a3bc1110e8bda"></a><br/></td></tr>
<tr class="separator:a43b310835f4c5f0ab84a3bc1110e8bda inherit pub_methods_class_automobile"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab4411b280ecc878442faf43c0cf080b0 inherit pub_methods_class_automobile"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_automobile.html#ab4411b280ecc878442faf43c0cf080b0">Detach</a> (<a class="el" href="class_i_display.html">IDisplay</a> *obs)</td></tr>
<tr class="memdesc:ab4411b280ecc878442faf43c0cf080b0 inherit pub_methods_class_automobile"><td class="mdescLeft">&#160;</td><td class="mdescRight">Removes obs from the list of observers.  <a href="#ab4411b280ecc878442faf43c0cf080b0"></a><br/></td></tr>
<tr class="separator:ab4411b280ecc878442faf43c0cf080b0 inherit pub_methods_class_automobile"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_class_object"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_class_object')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="class_object.html">Object</a></td></tr>
<tr class="memitem:aa3e791419d84c4c346ef9499513b8e00 inherit pub_methods_class_object"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_object.html#aa3e791419d84c4c346ef9499513b8e00">~Object</a> ()</td></tr>
<tr class="memdesc:aa3e791419d84c4c346ef9499513b8e00 inherit pub_methods_class_object"><td class="mdescLeft">&#160;</td><td class="mdescRight">DTor of the <a class="el" href="class_object.html" title="Common Baseclass for all other classes.">Object</a> class.  <a href="#aa3e791419d84c4c346ef9499513b8e00"></a><br/></td></tr>
<tr class="separator:aa3e791419d84c4c346ef9499513b8e00 inherit pub_methods_class_object"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pub_static_methods_class_object"><td colspan="2" onclick="javascript:toggleInherit('pub_static_methods_class_object')"><img src="closed.png" alt="-"/>&#160;Static Public Member Functions inherited from <a class="el" href="class_object.html">Object</a></td></tr>
<tr class="memitem:a86a84ed2d1207e5f8827165ac2941106 inherit pub_static_methods_class_object"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_object.html#a86a84ed2d1207e5f8827165ac2941106">deleteObject</a> (<a class="el" href="class_object.html">Object</a> *obj)</td></tr>
<tr class="memdesc:a86a84ed2d1207e5f8827165ac2941106 inherit pub_static_methods_class_object"><td class="mdescLeft">&#160;</td><td class="mdescRight">Frees the memory used by obj.  <a href="#a86a84ed2d1207e5f8827165ac2941106"></a><br/></td></tr>
<tr class="separator:a86a84ed2d1207e5f8827165ac2941106 inherit pub_static_methods_class_object"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pro_types_class_automobile"><td colspan="2" onclick="javascript:toggleInherit('pro_types_class_automobile')"><img src="closed.png" alt="-"/>&#160;Protected Types inherited from <a class="el" href="class_automobile.html">Automobile</a></td></tr>
<tr class="memitem:abf006ff8710f4f6e857f432eb151e325 inherit pro_types_class_automobile"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abf006ff8710f4f6e857f432eb151e325"></a>
typedef std::list&lt; <a class="el" href="class_i_display.html">IDisplay</a> * &gt;<br class="typebreak"/>
::const_iterator&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_automobile.html#abf006ff8710f4f6e857f432eb151e325">TObserversConstIterator</a></td></tr>
<tr class="memdesc:abf006ff8710f4f6e857f432eb151e325 inherit pro_types_class_automobile"><td class="mdescLeft">&#160;</td><td class="mdescRight">A constant Iterator for the observers list. <br/></td></tr>
<tr class="separator:abf006ff8710f4f6e857f432eb151e325 inherit pro_types_class_automobile"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2019c87470f292f3b7b25e0af2b22477 inherit pro_types_class_automobile"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2019c87470f292f3b7b25e0af2b22477"></a>
typedef std::list&lt; <a class="el" href="class_i_display.html">IDisplay</a> * &gt;<br class="typebreak"/>
::iterator&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_automobile.html#a2019c87470f292f3b7b25e0af2b22477">TObserversIterator</a></td></tr>
<tr class="memdesc:a2019c87470f292f3b7b25e0af2b22477 inherit pro_types_class_automobile"><td class="mdescLeft">&#160;</td><td class="mdescRight">An Iterator for the observers list. <br/></td></tr>
<tr class="separator:a2019c87470f292f3b7b25e0af2b22477 inherit pro_types_class_automobile"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pro_methods_class_automobile"><td colspan="2" onclick="javascript:toggleInherit('pro_methods_class_automobile')"><img src="closed.png" alt="-"/>&#160;Protected Member Functions inherited from <a class="el" href="class_automobile.html">Automobile</a></td></tr>
<tr class="memitem:ae54e63094fff2815c982517b498cd54c inherit pro_methods_class_automobile"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_automobile.html#ae54e63094fff2815c982517b498cd54c">Notify</a> () const </td></tr>
<tr class="memdesc:ae54e63094fff2815c982517b498cd54c inherit pro_methods_class_automobile"><td class="mdescLeft">&#160;</td><td class="mdescRight">Updates all observers.  <a href="#ae54e63094fff2815c982517b498cd54c"></a><br/></td></tr>
<tr class="separator:ae54e63094fff2815c982517b498cd54c inherit pro_methods_class_automobile"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Represents a <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> which is a specialisation of an <a class="el" href="class_automobile.html" title="Represents an Automobile.">Automobile</a>. </p>
<p>The class <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> represents a <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> which is derived by <a class="el" href="class_automobile.html" title="Represents an Automobile.">Automobile</a>. A <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> currently has a Speedometer and an Odometer. In terms of Design patterns, a <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> is a concrete subject which holds data about the speed the <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> is going.</p>
<dl class="section author"><dt>Author</dt><dd>Thomas Pfeiffer </dd></dl>
<dl class="section date"><dt>Date</dt><dd>13.11.2012 </dd></dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ac57dd13707ca4927aafd391d01b5b445"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">PKW::PKW </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>wheel_diameter</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="class_wheel_spin_sensor.html">WheelSpinSensor</a> *&#160;</td>
          <td class="paramname"><em>sens</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The CTor of the <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a>. </p>
<p>Constructs the <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> and sets the wheel diameter. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">wheel_diameter</td><td>The wheel diamter of the <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> in mm. </td></tr>
    <tr><td class="paramname">sens</td><td>The <a class="el" href="class_wheel_spin_sensor.html" title="This class simulates a wheelspinsensor.">WheelSpinSensor</a> which feeds the <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> with Wheel Revolution Data. sens is automatically freed when the <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> is being destroyed. If sense is an invalid pointer (0) then the <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> uses 0 as its revolutions anytime process() is called. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a49bb675b5f0878b6e1a802c518c2f476"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">PKW::~PKW </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>DTor of the <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a>. </p>
<p>The destructor of the <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a> frees the memory which is allocated by its <a class="el" href="class_wheel_spin_sensor.html" title="This class simulates a wheelspinsensor.">WheelSpinSensor</a>. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a81df69d9bf3f95fc114a7f73e3657be7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">double PKW::GetCurrentSpeed </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the current speed of the car. </p>
<p>The function <a class="el" href="class_p_k_w.html#a81df69d9bf3f95fc114a7f73e3657be7" title="Returns the current speed of the car.">GetCurrentSpeed()</a> calculates the speed of the car by using the Diameter and the revolutions. The formula for the calculations is: (revolutions / 60) x diameter/1000 x PI x 3.6 = speed km/h </p>
<dl class="section return"><dt>Returns</dt><dd>the last calculated speed of the <a class="el" href="class_p_k_w.html" title="Represents a PKW which is a specialisation of an Automobile.">PKW</a>. </dd></dl>

</div>
</div>
<a class="anchor" id="a2c57cf65470a857c1c37e662433c16fd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void PKW::Process </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Update the current speed. </p>
<p>Reads the data from the Wheel spin sensor and stores the current revolutions returned by the sensor. Notify is called which causes all observers to update their data. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="class_p_k_w.html">PKW</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.2 </li>
  </ul>
</div>
</body>
</html>
